In a computer system, or in any system that operates computer software, the size of the application code that runs thereon has a critical impact on the overall performance of the system. Larger application codes take up more memory space and utilize more system resources than smaller application codes. With an increase in application code size, and a decrease in available system resources, the performance of the system is greatly reduced. As more and more system vendors find that the distinguishing feature between their product and a competitors often hinges on the relative performance of their products, the need to increase system performance at every level is increasingly more important in today's environment.
The size of a particular piece of application code is not necessarily static over time. In many instances, the application code is recompiled again and again, sometimes for performance reasons, or for failover reasons. In static systems, this compilation process may only happen intermittently, whereas in a dynamic system such as in a Java virtual machine (JVM) environment, the recompilation process may happen almost continuously. With each recompile, the application code is altered or modified in some way to reflect the current state of the system.
An important goal of the recompilation process in a Java virtual machine or other dynamic environment, is to generate new application code on the fly, such that the new application code operates with greater performance than the previous code i.e., either in a smaller memory space, or with faster performance, or in using less of the available resources. An important goal of all recompilation processes as they are used in this manner to optimize the performance of the application code, is that they should not result in some decrease in performance. A common method of optimizing application code during compilation, is to “in-line” frequently called methods within the body of the application code itself, i.e., replacing calls to external methods with spliced inserts of those external methods in the application code itself, thus reducing the number of call overheads to external methods. An obvious problem with this approach is that as each method segment is spliced into the application code, the original application code greatly increases in size, often referred to as “code bloat”, so that the net effect may be no performance increase at all. The developer must at all time be attuned to the varying needs of the system in maximizing application execution speed, while minimizing code bloat. The overall effect is a balancing one, in which application code size limits the types and frequency of optimizations the system can perform.
Furthermore, traditional systems rarely take into account any form of dynamic optimization, such as how an application code may be optimized to better address the running environment. The traditional method of code optimization is to monitor the size of the application code in memory and to perform optimizations to keep the application code within a certain memory size range. However, none of these techniques of code optimization address the individual needs of particular environments, or of virtual machines running in these environments.